import BookListPackage.BookList;
import Preson.Manager;
import Preson.Person;
import Preson.User;

import java.util.Scanner;

public class execute {
    public static Person login () {

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入名字：");
        String name = scanner.nextLine();
        while (true) {
            System.out.println("请输入你的身份：1 -》管理员  0 -》用户");
            int i = scanner.nextInt();
            if (i == 1) {
               return new Manager(name);
            } else if (i == 0) {
                return new User(name);
            }
            System.out.println("输入不合理，请重新输入！ 1/0");
            System.out.println("-----------------------");
        }

    }
    public static void main(String[] args) {
        BookList bookList = new BookList();
        //bookList.books
        Person person = login();
        while (true) {
            int choice = person.mun();
            person.operate(choice, bookList);
        }


    }
}
